/*
package com.it.selfafter.controller;

import com.it.selfrequest.pojo.Test;
import com.it.selfrequest.service.TestService;
import com.it.selfrequest.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("/api")
@RestController
@Api(tags = "用户相关接口,提供用户的增删改查功能")
@Slf4j
@CrossOrigin(origins = "*") // 解决跨域问题
public class TestController {

    @Autowired
    private TestService testService;


    @GetMapping("/getAll")
    @ApiOperation(value = "获取所有用户的列表", notes = "获取所有用户的列表")
    public Result<?> getAll() {
        return Result.success(testService.getAll());
    }

    @ApiOperation(value = "根据ID获取用户信息", notes = "根据用户 ID 获取用户信息")
    @GetMapping("/{id}")
    public Result<?> getTestById(@ApiParam(value = "用户ID", required = true) @PathVariable Long id) {
        return Result.success(testService.getTestById(id));
    }

    @ApiOperation(value = "根据用户名获取用户信息", notes = "根据用户 username 获取用户信息")
    @GetMapping("/username/{username}")
    public Result<?> getTestByUsername(@ApiParam(value = "用户名", required = true) @PathVariable String username) {
        return Result.success(testService.getTestByUsername(username));
    }

    @ApiOperation(value = "新增用户", notes = "新增一个用户")
    @PostMapping("/")
    public Result<?> addUser(@ApiParam(value = "用户信息", required = true) @RequestBody Test test) {
        return Result.success(testService.save(test));
    }

    @ApiOperation(value = "更新用户信息", notes = "根据用户 ID 更新用户信息")
    @PutMapping("/")
    public Result<?> updateUser(@ApiParam(value = "用户信息", required = true) @RequestBody Test test) {
        return Result.success(testService.update(test));
    }

    @ApiOperation(value = "删除用户", notes = "根据用户id删除用户信息")
    @DeleteMapping("/{id}")
    public Result<?> deleteTestById(@PathVariable Long id) {
        return Result.success(testService.deleteTestById(id));
    }

    @ApiOperation(value = "根据ids批量删除用户", notes = "根据用户id批量删除用户信息")
    @DeleteMapping("/ids/{ids}")
    public Result<?> deleteTestByIds(@PathVariable("ids") List<Long> ids) {
        if (ids.size() > 0) {
            for (Long id : ids) {
                testService.deleteTestById(id);
            }
        }
//        return Result.success(testService.deleteTestByIds(ids));
        return Result.success("批量删除成功");
    }

}
*/
